import React, { useEffect, useState } from 'react';
import { Routes, Route } from 'react-router-dom';
import { Home } from './pages/Home';
import { ProductReview } from './pages/ProductReview';
import { Guides } from './pages/Guides';
import { GuideDetail } from './pages/GuideDetail';
import { Community } from './pages/Community';
import { StoryDetail } from './pages/StoryDetail';
import { Privacy } from './pages/Privacy';
import { Navigation } from './components/Navigation';
import { Footer } from './components/Footer';
import { CookieBanner } from './components/CookieBanner';
import { Activities } from './pages/Activities';
import { Hiking } from './pages/activities/Hiking';
import { Climbing } from './pages/activities/Climbing';
import { Water } from './pages/activities/Water';
import { Cycling } from './pages/activities/Cycling';
import { Camping } from './pages/activities/Camping';
import { AboutUs } from './pages/AboutUs';
import { OurTeam } from './pages/OurTeam';
import { Methodology } from './pages/Methodology';
import { Loadouts } from './pages/Loadouts';
import { LoadoutDetail } from './pages/LoadoutDetail';
import { Contact } from './pages/Contact';
import { Reports } from './pages/Reports';
import { ReportDetail } from './pages/ReportDetail';
export function App() {
  const [showCookieBanner, setShowCookieBanner] = useState(false);
  useEffect(() => {
    // Check if user has already accepted cookies
    const cookiesAccepted = localStorage.getItem('cookiesAccepted');
    if (!cookiesAccepted) {
      setShowCookieBanner(true);
    }
  }, []);
  const handleAcceptCookies = () => {
    localStorage.setItem('cookiesAccepted', 'true');
    setShowCookieBanner(false);
  };
  return <div className="flex flex-col min-h-screen bg-earth-dark font-body text-sand-light">
      <Navigation />
      <main className="flex-grow">
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/review/:productId" element={<ReportDetail />} />
          <Route path="/reports" element={<Reports />} />
          <Route path="/guides" element={<Guides />} />
          <Route path="/guides/:guideId" element={<GuideDetail />} />
          <Route path="/community" element={<Community />} />
          <Route path="/community/post/:postId" element={<StoryDetail />} />
          <Route path="/privacy" element={<Privacy />} />
          <Route path="/activities" element={<Activities />} />
          <Route path="/activities/hiking" element={<Hiking />} />
          <Route path="/activities/climbing" element={<Climbing />} />
          <Route path="/activities/water" element={<Water />} />
          <Route path="/activities/cycling" element={<Cycling />} />
          <Route path="/activities/camping" element={<Camping />} />
          <Route path="/about" element={<AboutUs />} />
          <Route path="/team" element={<OurTeam />} />
          <Route path="/methodology" element={<Methodology />} />
          <Route path="/loadouts" element={<Loadouts />} />
          <Route path="/loadouts/:loadoutId" element={<LoadoutDetail />} />
          <Route path="/contact" element={<Contact />} />
        </Routes>
      </main>
      <Footer />
      {showCookieBanner && <CookieBanner onAccept={handleAcceptCookies} />}
    </div>;
}